<?php

namespace App\Admin\Tools\Task;

use App\Models\CustomerModel;
use App\Models\TaskModel;
use App\Models\TaskRelatedModel;
use Encore\Admin\Grid\Tools\AbstractTool;
use Illuminate\Contracts\View\View;

class TaskRelatedTool extends AbstractTool
{
    private int $id;

    public function __construct(int $id)
    {
        $this->id = $id;
    }

//    public function render()
//    {
//        $customer = CustomerModel::query()->where('id', $this->id)->first();
//
//        return view('customer.delete', [
//            'id' => $this->id,
//            'name' => $customer->customer_name
//        ]);
//    }

    /**
     * @inheritDoc
     */
    public function render()
    {
        $model = TaskModel::query()->with('taskRelated')->where('id', $this->id)->first();

        return view('task.task_related_detail', [
            'id' => $this->id,
            'data' => TaskModel::query()->with('taskRelated')->where('id', $this->id)->first(),
        ]);
//        return "<a class='btn btn-info btn-xs' href='/admin/task/related/" . $this->id . "'>资源预览</a>";
    }
}

